package com.cskaoyan.day17;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class OutputStreamTest {
    public static void main(String[] args) {
        String str;
        System.out.print("请输入你需要录入的文件绝对路径：");
        Scanner scanner = new Scanner(System.in);
        String path = scanner.nextLine();
        System.out.print("请输入你需要录入的内容：");
        try (FileOutputStream fileOutputStream = new FileOutputStream(path, true)) {
            while (!(str = scanner.nextLine()).equals("end")) {
                fileOutputStream.write(str.getBytes());
                fileOutputStream.write(System.lineSeparator().getBytes());

            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
